package cn.sh.yhk.mapper.basic;

import cn.sh.yhk.model.basic.SRegion;
import cn.sh.yhk.model.basic.SRegionExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface SRegionMapper {
    @SelectProvider(type = SRegionSqlProvider.class, method = "countByExample")
    long countByExample(SRegionExample example);

    @DeleteProvider(type = SRegionSqlProvider.class, method = "deleteByExample")
    int deleteByExample(SRegionExample example);

    @Insert({
            "insert into s_region (ID, REGION, ",
            "REMARK, FOUND_TIME, ",
            "REVISE_TIME, STATE)",
            "values (#{id,jdbcType=INTEGER}, #{region,jdbcType=VARCHAR}, ",
            "#{remark,jdbcType=VARCHAR}, #{foundTime,jdbcType=TIMESTAMP}, ",
            "#{reviseTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER})"
    })
    int insert(SRegion record);

    @InsertProvider(type = SRegionSqlProvider.class, method = "insertSelective")
    int insertSelective(SRegion record);

    @SelectProvider(type = SRegionSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "ID", property = "id", jdbcType = JdbcType.INTEGER),
            @Result(column = "REGION", property = "region", jdbcType = JdbcType.VARCHAR),
            @Result(column = "REMARK", property = "remark", jdbcType = JdbcType.VARCHAR),
            @Result(column = "FOUND_TIME", property = "foundTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "REVISE_TIME", property = "reviseTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "STATE", property = "state", jdbcType = JdbcType.INTEGER)
    })
    List<SRegion> selectByExample(SRegionExample example);

    @UpdateProvider(type = SRegionSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SRegion record, @Param("example") SRegionExample example);

    @UpdateProvider(type = SRegionSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") SRegion record, @Param("example") SRegionExample example);
}